<!DOCTYPE html>
<html>
<head>
	<meta charset="UTF-8">
	<meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <link rel="stylesheet" href="../../css/utils/bootstrap.min.css" />
    <link rel="stylesheet" href="../../css/utils/common.css?version=1" />
    <link rel="stylesheet" href="../../css/utils/toastr.min.css" />
	<title></title>
	<style>
	</style>
</head>
<body>
	<div class="content">
		<div class="table-list">
			<table class="table table-bordered table-hover table-striped">
				<thead>
					<tr>
						<th>序号</th>
						<th>头像</th>
						<th>昵称</th>
						<th>地址</th>
						<th>转发数</th>
						<th>门票状态</th>
						<th>检票时间</th>
						<th>获得门票时间</th>
					</tr>
				</thead>
				<tbody id="customertbody">
				</tbody>
			</table>
			<nav id="page" class="text-center" aria-label="Page navigation">
				<ul class="pagination">
				</ul>
			</nav>
		</div>	
	</div>
	<script type="text/javascript" src="../../js/utils/jquery-1.12.4.min.js" ></script>
	<script type="text/javascript" src="../../js/utils/bootstrap.min.js" ></script>
	<script type="text/javascript" src="../../js/utils/jquery.cookie.js" ></script>
	<script type="text/javascript" src="../../js/utils/page.js" ></script>
	<script type="text/javascript" src="../../js/utils/toastr.min.js" ></script>
	<script type="text/javascript" src="../../js/utils/boot.js" ></script>
	<script>
		var userID,companyID;
		var ticketsID = base.getParameter("ticketsID");
		var tempPageNo = 1;
		$(function(){
			userID = $.cookie("userID");
			companyID = $.cookie("companyID");
			toastr.options = {
                "timeOut": 2000,
                "positionClass": "toast-middle-center"
           	};
           	getTicketsDetailsList();
		});
		//获取深度分析客户
		function getTicketsDetailsList(){
			base.postData(base.url.getTicketsDetails, {ticketsID:ticketsID,pageNo:tempPageNo,userID:userID,companyID:companyID}, callbackGetTicketsDetails);
		}
		function callbackGetTicketsDetails(data) {
			if (data.success) {
				if (tempPageNo == 1) {
					var _totalPage = Math.ceil(data.context.totalPage/10)||1;
					//初始化分页
					var page = {
						pageIndex:1,//初始页
						currentPage:1,//当前页
						showPage:5,//显示页数
						totalPage:_totalPage,//总页数
						onPageClick: function(page) {
							tempPageNo = page.currentPage;
							getTicketsDetailsList();
							$("#page").initPage(page);
			    			return false;  //默认的翻页事件
					    }
					};
				}
				$("#page").initPage(page);
				$("#customertbody").html(getGetTicketsDetailsHtml(data.context.ticketsDetail));
			} else {
				toastr.error(data.msg);
			}
		}
		function getGetTicketsDetailsHtml(list) {
			var html = '';
			for (var index in list) {
				html += '<tr>'
				html += '	<td class="index-td">'+(index*1+1)+'</td>'
				html += '	<td><img class="border-radius-30" src="'+list[index].headImg+'" /></td>'
				html += '	<td>'+list[index].nickName+'</td>'
				html += '	<td>'+list[index].address+'</td>'
				html += '	<td>'+list[index].transpondNumber +'</td>'
				html += '	<td>'+(list[index].checkTickets==1?"已检票":"未检票") +'</td>'
				html += '	<td>'+list[index].checkTicketsTime +'</td>'
				html += '	<td>'+list[index].createTime +'</td>'
				html += '</tr>'
			}
			return html;
		}
	</script>
</body>
</html>
